using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using BlueFinity.mvNET.CoreObjects;
using mvLibrary.Helpers.Utils;

namespace fenk.Stock
{
    public partial class Productos : mvLibrary.BaseForm
    {
        public Productos()
        {
            InitializeComponent();
        }
        public void CalcularPrecioNeto()
        {
            decimal iva;
            if (UniItem.ExtractAsString(6) != string.Empty)
            {
                 iva = Convert.ToDecimal(UniItem.ExtractAsString(6)) * 100;
            }
            else
            {
                 iva = 0;
            }
            string tasaIva = "1," + iva.ToString();
            string Lista1 = GetDefaultValue("@CALC " + textLista1.Text + " * 100 / " + tasaIva ,false, 1, 1);
            string Lista2 = GetDefaultValue("@CALC " + textLista2.Text + " * 100 / " + tasaIva, false, 1, 1);
            UniItem.Replace(4, Lista1);
            UniItem.Replace(19,Lista2);
            labelLista1.Text = DataBASIC.OConv(Lista1, "MD2");
            labelLista2.Text = DataBASIC.OConv(Lista2, "MD2");

        }
        private void mvTextBox5_Validated(object sender, EventArgs e)
        {
            // tasa de iva ya validada
            CalcularPrecioNeto();
        }

        private void mvTextBox6_Validated(object sender, EventArgs e)
        {
            // precio Lista 1 ya validado
            CalcularPrecioNeto();
        }

        private void mvTextBox7_Validated(object sender, EventArgs e)
        {
            // precio Lista 2 ya validado
            CalcularPrecioNeto();
        }

        private void panelId_Paint(object sender, PaintEventArgs e)
        {

        }

        
    }
}

